
import request from '@/utils/request'

import variable from '@/utils/variables'
const baseURL = variable.URL.baseURL

// 获取用户收货地址列表
export function getAddressList() {
	return request({
	    baseURL: baseURL,
	    url: '/member/address/list',
	    method: 'GET'
	})
}

// 添加用户收货地址列表
export function addAddress(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/address/insert_address',
	    method: 'POST',
	    params: params
	})
}

// 编辑会员收货地址
export function updateAddress(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/address/update_address',
	    method: 'PUT',
	    params: params
	})
}
// 设置默认地址

export function setDefaultAddress(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/address/set_default',
	    method: 'POST',
	    params: params
	})
}

// 删除收货地址
export function deleteAddress(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/address/delete_address',
	    method: 'DELETE',
	    params: params
	})
}

// 获得会员信息
export function getMemberInfo(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/select_by_user_id',
	    method: 'GET',
	    params: params
	})
}

// 查询会员订单数
export function getOrderNum(params) {
	return request({
	    baseURL: baseURL,
	    url: '/order/select_order_num',
	    method: 'GET',
	    params: params
	})
}

// 查询会员收藏数
export function getFavorites(params) {
	return request({
	    baseURL: baseURL,
	    url: '/favorites/count',
	    method: 'GET',
	    params: params
	})
}

// 查询会员我的足迹

export function getViewHistory(params) {
	return request({
	    baseURL: baseURL,
	    url: '/member/view_history/list',
	    method: 'GET',
	    params: params
	})
}

//修改昵称
export function saveNickName(params) {
	return request({
		baseURL: baseURL,
		url: '/member/update_user_nickname',
		method: 'PUT',
		params: params
	})
}

//修改头像信息
export function saveUserAvatar(params) {
	return request({
		baseURL: baseURL,
		url: '/member/update_user_avatar',
		method: 'PUT',
		params: params
	})
}

//获取收藏列表
export function getColletProduct(params) {
	return request({
		baseURL: baseURL,
		url: '/favorites/product/page',
		method: 'GET',
		params: params
	})
}

//获取云工厂收藏列表
export function getColletfactory(params) {
	return request({
		baseURL: baseURL,
		url: '/favorites/factory/page',
		method: 'GET',
		params: params
	})
}

//云工厂取消收藏
export function removeColletfactory(params) {
	return request({
		baseURL: baseURL,
		url: '/favorites/factory/cancel',
		method: 'DELETE',
		params: params
	})
}

//取消商品收藏
export function removeColletProduct(params) {
	return request({
		baseURL: baseURL,
		url: '/favorites/product/cancel',
		method: 'DELETE',
		params: params
	})
}

//批量删除商品
export function batchDelete(params) {
	return request({
		baseURL: baseURL,
		url: '/favorites/batch/cancel',
		method: 'DELETE',
		params: params
	})
}

//获取消息
export function getMessage(params) {
	return request({
		baseURL: baseURL,
		url: '/message/frontend/message/select',
		method: 'GET',
		params: params
	})
}

//删除消息
export function removeMessage(params) {
	return request({
		baseURL: baseURL,
		url: '/message/frontend/queue/delete',
		method: 'DELETE',
		params: params
	})
}

//消息全部已读
export function readMessage(params) {
	return request({
		baseURL: baseURL,
		url: '/message/frontend/queue/read',
		method: 'PUT',
		params: params
	})
}

//删除足迹
export function removeViewHistory(params) {
	return request({
		baseURL: baseURL,
		url: '/member/view_history/delete_ids',
		method: 'DELETE',
		params: params
	})
}

//添加发票信息
export function insertInvoice(params) {
	return request({
		baseURL: baseURL,
		url: '/member/invoice/insert_invoice',
		method: 'POST',
		params: params
	})
}

// 修改会员发票信息
export function updateInvoice(params) {
	return request({
		baseURL: baseURL,
		url: '/member/invoice/update_invoice',
		method: 'PUT',
		params: params
	})
}

// 删除会员发票信息
export function deleteInvoice(params) {
	return request({
		baseURL: baseURL,
		url: '/member/invoice/delete_invoice',
		method: 'DELETE',
		params: params
	})
}
// 获取会员发票信息列表
export function getInvoiceList(params) {
	return request({
		baseURL: baseURL,
		url: '/member/invoice/list',
		method: 'GET',
		params: params
	})
}
// 获取会员发票信息详情
export function getInvoiceInfo(params) {
	return request({
		baseURL: baseURL,
		url: '/member/invoice/info',
		method: 'GET',
		params: params
	})
}
